package com.wondertek.poms.core.service.impl;

import com.wondertek.poms.common.service.impl.ServiceImpl;
import com.wondertek.poms.core.service.IDefaultPrdSalService;
import com.wondertek.poms.dao.po.DefaultPrdSal;
import com.wondertek.poms.dao.repo.IDefaultPrdSalDao;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p><b>PcProductRuleServiceImpl Description:</b> 二级产品规则 service层实现 </p>
 *
 * @author 窦再兴
 * <p><b>DATE</b> 2020-10-16 15:56:15</p>
 */
@Service
public class DefaultPrdSalImpl extends ServiceImpl<DefaultPrdSal, Long> implements IDefaultPrdSalService {

	@Autowired
	private IDefaultPrdSalDao defaultPrdSalDao;

	@Override
	public DefaultPrdSal deleteLogic(Long id) {
		return null;
	}

	@Override
	public DefaultPrdSal merge(DefaultPrdSal model) {
		return null;
	}

	@Override
	public List<DefaultPrdSal> findAllByPrdInfoId(String prdInfoId) {
		return defaultPrdSalDao.findAllByPrdInfoId(prdInfoId);
	}

	@Override
	public DefaultPrdSal update(DefaultPrdSal defaultPrdSal) {
		DefaultPrdSal one = jpaRepository.getOne(defaultPrdSal.getId());
		BeanUtils.copyProperties(defaultPrdSal, one);
		return jpaRepository.save(one);
	}
}